//
//  GoodsListColCell.m
//  WuJieLive
//
//  Created by haidong on 2017/12/26.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "GoodsListColCell.h"

@interface GoodsListColCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imgV;
@property (weak, nonatomic) IBOutlet HDLabel *integralLab;
@property (weak, nonatomic) IBOutlet HDLabel *titleLab;
@property (weak, nonatomic) IBOutlet HDLabel *priceLab;
@property (weak, nonatomic) IBOutlet HDLabel *originPriceLab;
@property (weak, nonatomic) IBOutlet HDLabel *evaluateLab;

@end

@implementation GoodsListColCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.integralLab.bounds
                                                   byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight
                                                         cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.integralLab.bounds;
    maskLayer.path = maskPath.CGPath;
    self.integralLab.layer.mask = maskLayer;
}

- (void)bindData:(id)entity {
    
    if ([entity isKindOfClass:[GoodsListEntity class]]) {
        GoodsListEntity *goodsEntity = (GoodsListEntity *)entity;
        [self.imgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", goodsEntity.picture_url]] placeholderImage:[UIImage imageNamed:@""]];
        self.integralLab.text = [NSString stringWithFormat:@"赠送积分%@", goodsEntity.gift_integration_scale];
        self.titleLab.text = [NSString stringWithFormat:@"%@", goodsEntity.goods_name];
        self.priceLab.text = [NSString stringWithFormat:@"¥%@", goodsEntity.price];
        self.originPriceLab.text = [NSString stringWithFormat:@"¥%@", goodsEntity.price_coupon];
        [self.originPriceLab setLineType:HDLabelCenterLine];
        [self.originPriceLab setLineColor:TextLessImportColor];
        self.evaluateLab.text = [NSString stringWithFormat:@"%@好评", goodsEntity.comment_star];
    }
    
}

@end
